<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // flat  flatMap
        // 将多维数组转为低维数组
        const arr = [1, 2, [3, 4, [5, 6, 7]]]
        console.log(arr.flat())
        console.log(arr.flat(2))

        // flatMap
        const arr1 = [1, 3, 4, 5]
        const r1 = arr1.map(item => [item * 10])
        const r2 = arr1.flatMap(item => [item * 10])
        console.log(r2)
    </script>
</body>
</html>